<ui:composition 
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">     

    <p:dataTable value="#{menuBean.menu.menuItem}" var="m"
                 scrollHeight="300" scrollable="true"
                 emptyMessage="No se encontraron registros" >

        <p:column headerText="#{msgs.nombre}" style="width: 150px;"
                  filterBy="#{m.nombre}" >
            <h:outputText value="#{m.nombre}" rendered="#{not (m.id == -1)}"  />
            <p:inputText value="#{m.nombre}" rendered="#{m.id == -1}"  />
        </p:column>

        <p:column headerText="#{msgs.url}" style="width: 200px;"
                  filterBy="#{m.url}" >
            <h:outputText value="#{m.url}" rendered="#{not( m.id == -1)}"    />
            <p:inputText value="#{m.url}" rendered="#{m.id == -1}"  />
        </p:column>
        
        <p:column headerText="#{msgs.activo}" >
            <p:selectBooleanCheckbox value="#{m.activo}" rendered="#{not( m.id == -1)}"   />
        </p:column>

        <p:column headerText="#{msgs.accion}" style="width: 80px;" >

            <h:panelGrid rendered="#{m.id > 0}" cellpadding="0" cellspacing="0"  columns="2" style="border: transparent; width: 60px;" >
                <p:commandButton icon="ok16" actionListener="#{menuBean.selecionar(m)}"
                                 update="pgDatos" styleClass="btnTabla" />
                <p:commandButton icon="delete16"
                             actionListener="#{menuBean.agregarItem}"
                             update="pgDatos" styleClass="btnTabla"  />
            </h:panelGrid>
            
            <p:commandButton icon="add16" actionListener="#{menuBean.eliminarItem(m)}"
                             update="pgDatos" rendered="#{m.id == -1 }" styleClass="btnTabla" />
        </p:column>

    </p:dataTable>
 
</ui:composition>

